<?php

namespace Itwmw\Attributes\Validate\Provider;

class MessageProvider extends \Itwmw\Validate\Support\MessageProvider
{
    public array $validateFieldPath;

    public function setValidateFieldPath(array $path): static
    {
        $this->validateFieldPath = $path;
        return $this;
    }

    protected function replacingFieldsInMessage(string $message): array|string
    {
        $message = str_replace(':path', implode('.', $this->validateFieldPath), $message);
        return parent::replacingFieldsInMessage($message);
    }
}
